/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hidroponia;


import GUI.Bienvenido;
import GUI.LoginDialog;
import java.awt.*;
import java.awt.event.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;


/**
 *
 * @author andresgodoysalavert
 */
public class Hidroponia {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws SQLException {
        
 
        // TODO code application logic here
        Bienvenido principal = new Bienvenido();
        principal.setVisible(true);
        final JFrame frame = new JFrame("JDialog Demo");
        final JButton btnLogin = new JButton("Click to login");
         
        btnLogin.addActionListener(
                new ActionListener(){
                    public void actionPerformed(ActionEvent e) {
                        LoginDialog loginDlg = new LoginDialog(frame);
                        loginDlg.setVisible(true);
                        // if logon successfully
                        if(loginDlg.isSucceeded()){
                            btnLogin.setText("Hi " + loginDlg.getUsername() + "!");
                        }
                    }
                });
        
 
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(300, 100);
        frame.setLayout(new FlowLayout());
        frame.setLocation(500, 300);
        frame.getContentPane().add(btnLogin);
        frame.setVisible(true);
    }
}
